<?php
namespace app\Admin\controller;
use think\Controller;
use think\Session;
use think\Request;
class Base extends Controller
{
	public function __construct(Request $request)
	{
		parent::__construct();

		$auth = in_array($request->action(), array('login','dologin','logout','videoqrcode','videocode','videoqrcodes','videocates','json','versionQrcode','versionQrcodes'));
		if(!$auth){
			$adminUserId = Session::get('adminUserId');
			if(empty($adminUserId)){
				$this->error('请先登陆','admin/admin/login');
			}else{
				$adminUser = Db('adminuser')->where('id',Session::get('adminUserId'))->find();
				$nopower = explode(',',$adminUser['nopower']);
				foreach($nopower as $k => $v){
					//被禁用的方法名
					$activeName[] = Db('auth_rule')->where('id',$v)->find()['name'];
				}
				// var_dump($activeName);die;
				$auths = in_array($request->action(),$activeName);
				if($auths){
					$this->error('暂无权限操作');
				}
			}
		}
	}

}

